///WARNING: INCOMING RANT///
As much as people are saying that the Empire couldn't win against the Ewoks, yes, that was a fucking stupid part of ROTJ. But, their armour was never seen to be ineffective against Ewok weapons. The only Stormtroopers that we see being taken down by their weapons were either concussed by big ass rocks falling on their head or were caught off-guard and pummelled while they were down, and no helmet in the galaxy is going to protect you when it smacks you in the face. Also, the arrows that took down stormtroopers? They all penetrated the flexible black material which is not armour. Really, those were fluke shots. Also, despite there being a TVTropes page on 'Imperial Stormtrooper Marksmanship Academy', their accuracy isn't actually that bad. One stormtrooper misses Han's head by less than an inch in the detention scene in ANH. Real-world marksmanship is not a lot worse, it's just that the stormtroopers have the misfortune of being able to see their misses, which makes it seem a lot worse.
Anyway, after that long diatribe, I do think that the Imperium of Man would win out. This of course assumes that neither power has to deal with their natural enemies and instead focus on each other, so the Imperium isn't contending against the various flavours of alien, mutant and heretic, and the Empire isn't forced to deal with the Rebellion. There are a couple of reasons for this (along with a few counterpoints) that need to be addresed in seperate paragraphs, but one of the biggest is the economies that can be brought to bear. (Just a note on terminologies, Empire/Imperial ALWAYS refers to SW Wpire, and Imperium refers to that of 40k)
The Empire is also (obviously) a galactic empire, encompassing millions of planets, but the grand total military expendature is a fraction of that of the Empire's net worth. The Imperium, by contrast, is an entire pan-galactic civilisation that literally only exists to wage war on an unimaginably vast scale. So in terms of infrastructure, the Imperium is already far more mobilised that the Empire, despite being somewhat smaller in terms of territory. It has entire forge worlds dedicated to making weapons for their forces. So the Empire has Coruscant, a planet completely covered by whiney politicians, and this is considered amazing. The Imperium, on the other hand, has dozens of planets covered in factories designed to produce immense quentities of materiel specifically for further war-making. You can keep Coruscant.
In space battles, the Imperium has huge ships, and the Empire has huge ships, but the Imperium's battleships can dish out and take far more punishment. Their lance batteries are insanely desructive, and Nova cannons are insanely destructive weapons. Most of these weapons are also designed to bombard a planet and crack its mantle. Their shields also have to take this kind of abuse for significant periods of time, so they must be correspondingly strong. Imperial Turbolasrers are stong, sure, but they rely mostly on weight of fire rather than being insanely destructive. Basically this is insanely destructive weapons versus smaller but more numerous weapons, but on average Imperium capital ships can take and dish out much more damage weight for weight. However, Imperial Star Destroyers are far more common in the Imperial Navy than Imperium battleships in their Navy. Most battlegroups would be lucky to have more than a dozen heavy capital ships, relying more on cruisers. My personal theories are that an Imperium medium cruiser is somewhat more powerful, both in terms of offensive and defensive abilities than an ISD, and their rarer battleships are far more powerful.
On the other hand, Imperium ships are clumsy beasts in combat, both in terms of combat speeds and manoeuvrability, so a decent Imperial admiral could take advantage of this and use specific tactics to their advantage, but it's a fair bet that Imperium admirals would also be able to come up with tactics to prevent this. Also, Hyperspace travel (as used by the Empire) is far quicker than Warp travel (used by the Imperium). In official literature of the 40k books, crossing the Imperium (somewhat less than the full diameter of the galaxy) via the Warp take around a full year, wheras according to the semi-cannon SW books, Hyperspace travel can cross that galaxy somewhere in the order of a few weeks. Therefore the Empire could travel much faster than the Imperium and make sneak attacks on undefended assets, or force Imperium fleets to fight on their terms. The Imperium does leave comparatively massive garrison forces, however, so the Empire would have to pick its targets very carefully to maximise their advantage on the offensive. If they were fighting on the defensive in their galaxy, they would be able to redeploy forces far more rapidly to counter Imperium attacks.
On the whole, Imperial hyperspace technology gives them a tactical edge, but their starships are pound for pound somewhat weaker than their Imperium counterparts.
On the ground the balance of power is more finely balanced. To the Imperium's favour is the vast armoured support it commands. Large numbers of entire regiments of tanks regularly take to the field, carrying huge amounts of firepower, and companies of artillery vehicles like the Basilisk would pummel Imperial forces. Baneblade super-heavy tanks could probably take on a couple of AT-ATs singlehandedly and prevail. Even though they are extremely rare, a single Titan could obliterate an entire Imperial battlegroup. Even a Warhound Titan could munch through a decent-sized army on its own and only be destroyed by an inordinate redirection of firepower. Imperium armour is also far more varied in its arsenal. While Imperial units use various sizes of blaster weaponry, with the occasional missile, the Imperium vehicles (and ground troops) use combinations of explosive shells, armour peircing shells, various flavours of laser blasts, rocket-powered sub-atomic blast shells, flamethrowers, missiles and rockets. The blaster, even high-powered blasters like those on the AT-AT, are jack-of-all-trades weapons, and it's more likely that Imperium commanders could find specific weapon types that would be more effective against Imperial forces. Guardsmen squads also have access to much more support weaponry than the average stormtrooper squad, such as grenade launchers, flamers, plasma and melta guns, heavy bolters, autocannons, lascannons, light mortars etc. Also, coming back to the industrial capacity of these two powers, and decent battle will involve at least several entire armoured regiments as well as tens of thousands of Imperial Guardsmen. While stormtroopers are indeed very common, most Imperial commanders would be extremely lucky to have a dozen AT-ATs, whereas the Imperium can field hundreds of comparably weaker tanks.
On the flip side, this disparity in numbers also corresponds to an increase in power on the Imperial side. AT-AT walkers would be far more powerful than Leman Russ tanks and able to soak up a lot of firepower. This is even more evident when looking at the ground troops. Stormtroopers are highly-trained, indoctrinated, motivated soldiers wearing extensive, highly protective armour, whereas Guardsmen, as much as I love them, are usually conscripts who are trained in a fairly brief time period and given sub-par protection. There are many regiments who are regarded as veteran by the standards of the Imperial Guard who would help redress this balance, but even these veterans would probably only match the training and experience of the average stormtrooper, and then they'd still be fighting with inferior weapons and armour. Also, stormtroopers have access to both light support machine guns (i.e. repeating blasters) as well as heavy ones, like the E-Web cannon, wheras the Imperial Guard tends only to have the latter in the heavy bolter or autocannon. Because of their much better armour, somewhat more effective weapons, and their far superior training, the average stormtrooper force could probably go toe-to-toe with a force of guardsmen between 2-4 times more numerous, and stormtroopers are pretty damn numerous themselves. Also, the use of shields on ground vehicles is far more common in the Empire, and although most vehicles don't use them, the ones that do would be able to soak up a lot of fire.
So yeah, in my opinion, the Imperium would win the war due to its vastly more militarised nature, but Imperial forces would win a heck of a lot of battles due to its superior tactical speed and infantry. Eventually, I think that the Empire would be ground down by the boots of billions of Imperial Guardsmen and thousands of tanks. And that's not even bringing the Astartes into the equation.
By the way, I recently discovered a great website that talked about this sort of thing, except between the Empire and the Federation from Star Trek.
http://www.stardestroyer.net/Empire/
The guy makes some good arguments, even if I don't agree with everything he says.
Any thoughts/rebuttals?