What you want to do is
calculate "gear inches".
All things being equal, the road bike with 23c tires running in 34x28 is 31.89 gear inches
The trek with 35c wheels running in 28x24 is 31.70 gear inches. Pretty similar.
...unless my math is off in which case I apologize in advance. I used this site:
http://cycleseven.org/bicycle-gear-inch-calculator
edit: Just to be clear, though, this only accounts for one factor on how different bikes will feel when climbing hills. Don't forget to account for crank-arm length, bike geometry, handlebars, bike's weight, etc. All those good things.