They are the same, or the i5 would be infinitesimally faster, which would translate into no real world difference (certainly none above perceptual thresholds).
This article compared the i5 750 (2.66 GHz clockspeed) vs. the i7 860 (2.8 GHz clockspeed). Data shows the i7 inched ahead by an average of a 3% performance improvement on the whole. Make note that this is a lopsided comparison in favour of the i7 (if only marginally). The Macs you list would favour the heavier clockspeed on the i5. The i7 has hyperthreading (hence seeing the 8 cores) but that doesn't do enough to give it a substantial lead.
The article also shows the i5 outperforming the i7 in power consumption, which should be a deciding factor when buying a notebook.
But at the end of the day, you are comparing a notebook with a desktop, so it's a little lopsided. The iMac has a much better video card and a larger screen with a higher resolution. There is much more to a system than the CPU. On a whole, the iMac is a faster (better) machine, but not portable.