Yes it's perfectly fine to grow tomatoes and cucumbers in the same greenhouse but just use different planters for them and have them grow separately away from each other.
I've grown all sorts of vegetables in the same greenhouse without any problems.
Tomatoes and Cucumbers can also be planted pretty close together when not in a greenhouse as they grow pretty well together.