While its obvious the Imperium would curbstomp pretty much any SW nation in a land war, Star Wars has one incredible advantage over 40k: It's FTL travel and communications are infinitely faster and more reliable than that of the Imperium.
In fact, Hyperdrives are so fast that Star Wars ships would be able to outmaneuver everyone in 40k besides the Necrons and Eldar, who, respectively, have the problems of most of their assets being inactive and having a really small population.
I'm not all that sure about how powerful 40k starships are, though from what I know they aren't that much more powerful than Star Wars ships if they're even more powerful at all.
Having such a huge mobility advantage also has the nice benefit of marginalizing the Space Marines outside of their home systems, and would pretty much allow a Star Wars power to go around sterilizing Agri worlds until all the Forge and Hive worlds were crippled by famine. It also makes Impeium forces particularly vulnerable to the effects of attrition, since they can't resupply their forces in a timely manner.
See the difference here, is why WH40k explains it's economy and democracy Star Wars goes out of it's way to ignore that side of the fluff. They just assume things like food water and fuel are plentiful and always availiable where as WH40K has people fighting for something other than ideology.