Alrighty, sorry for the Double Post, but I feel it's worth bringing up some points to actually give a fair and balanced reasoning.
First, the Death Star. Stop bringing it up! People act as though the bastard things are a part of every fleet! We've seen two in the films, and I don't recall there ever being any more outside of Fanfics. Now, 40K has a Deathstar equivalent - the Planet Killer. It's far smaller (about half as long as a Super Star Destroyer), but it can still blow up planets. Literally, blow them up. It may not be Imperial, but the point remains that 40K has equivalent tech.
Now, let's focus on the mundane stuff, shall we? Rather than suggesting Darth Vader would personally fight the Imperium of Man, let's assume it's his armies and fleets that do it.
Stormtroopers:
Star Wars Stormtroopers aren't great. Their armour never seems to work for one. It seems fair to assume it is a Flak-equivalent; it protects from shrapnel, glancing hits, and mid-long range Blaster pistol / rifle shots. It's not designed to take a big hit and shrug it off.
Imperial Guard Stormtroopers have Carapace Armour, which can shrug off small arms (it's the equivalent of modern bullet-proof vests and such). They also have Hellguns, which make a mockery of anything short of Powered Armour (and in the newer rules, even that gets torn apart). As such, it seems best to treat SW Stormtroopers as 40K Guardsmen. The Imperium has a lot more Guard than SW has Stormtroopers (a million worlds, each providing 2,000 men a year minimum to the Imperial Guard, puts their recruitment at two billion soldiers a year. Then you factor in worlds like Cadia, who raise dozens or even hundreds of Regiments a year...).
Whilst a lot of people are reciting Space Marines, remember that 40K fluff states there is less than one Space Marine per world in the Imperium. They are not as common as the background makes them out to be, although they would obviously play a part if this hypothetical war became significant.
Star Destroyers:
As I have said, the Star Destroyer is tiny in 40K terms.
For those who don't understand the Gothic rule references I listed above, I shall try and explain; a Cobra has Str 1 Batteries. A battery consists of multiple guns of various types, ranging from massive shell-firing artillery to plasma cannons or laser cannons. All the weapons are treated as a single 'battery', with a Str value between 1 and 20. Batteries can stack if their fire arcs overlap.
The number of attack dice a Battery uses is worked out using a table, which varies the number of dice you roll based on range, direction the target is moving, and size (ie: an "Escort" like the Cobra, or a "Capital Ship" like the Cruisers or Battleships). Firepower 1 means the ship can only ever roll a single dice to attack with. It is therefore impossible for a Cobra, on its own, to ever threaten even the smallest of Cruisers; at best, it can knock a shield down, but then they simply reboot the shield next turn.
The Lunar is typical of an Imperial Navy Cruiser, with a Firepower of 6. That will typically work out to 3-4 attack dice against a fellow Cruiser, or 2-3 against an Escort (smaller target = harder to hit). Armour is a factor, but a Cruiser's batteries alone can usually knock a shield or two off its target. In the case of a Cobra, two hits would kill her - the first removes the shield, the second knocks off her single "Hit Point".
Then, we have Lances. Lances are massive energy cannons of unimaginable power. They always roll 1 dice per point of Firepower, regardless of range or other factors, and they always hit on a 4+ (the best roll possible). Batteries, by contrast, roll to hit using the armour value of their target (typically needing 5 or 6 on a single dice, or a roll of 6 against big warships). Essentially, being hit with a Lance is a death sentence.
Now, we remember that the Lunar has two Broadsides - it could fly between two targets and unleash enough firepower to destroy a few Escorts on either flank, or cause light damage to two equivalent cruisers (remember, most Cruisers have at least two shields you have to knock down first...). In addition to this, she can fire up to six Torpedoes a turn, which ignore shields.
A single Lunar Class Cruiser, therefore, could wade in against an entire Fleet of Star Destroyers, and blow the living hell out of them. Even if they get through her Shields, the Lunar has 8 Hits - it's eight times as durable as a Cobra.
The Lunar Class is also the single most common vessel in the Imperial Navy - there are countless other variations of Cruiser, Escort and Battleship out there... and the Astartes stuff is scary as hell.
Bat-Shit-Crazy Bigness!
Remember how the advance of the AT-AT made the ground shake? Remember how scared everyone gets when they see the Robot Cow approaching? Forget all that - 40K has God Machines.
Alright, let's be fair. The AT-AT is around 20m tall. That's, what, 65ft? The Warlord Titan is around 80-90ft tall (yes, FEET, a lot of people get this wrong), but compare their payloads.
First, Warlords are Void Protected. They have six Void Shield Generators, producing a cycling energy field that means as soon as one Void reaches critical, it shuts down and re-boots. In theory, a Warlord should always have at least one active Void Shield.
The presence of Voids gives the Titans a massive edge. Let's assume the AT-AT is just as strong, from a game mechanic point of view, as a Warlord - same armour, same number of Structure Points, main gun equal to a Volcano Cannon and secondary gun equal to Turbo Laser Destructor. The AT-AT will knock down most of the Warlord's Void Shields. Maybe even all of them. The Warlord then re-boots her shields (regaining, say, two of them) and returns fire - with no shields to protect her, the AT-AT will be crippled by the Warlord's volley. If the Warlord fired first, the AT-AT would be blown into a million pieces long before she scratched the Titan's paintwork.
All of this assumes, however, the AT-AT is as strong as the Warlord... and that's a big assumption. The AT-AT may be able to level a gun platform, Snow Speeder or a tank with a single burst of fire, but the Warlord is an Engine Killer - she's built to kill other Titans. You need entire Companies of battle tanks to threaten her when Titan-Killer weaponry is not available. A Titan doesn't go down unless two dozen Tanks all engage together. AT-ATs go down to towing cables.
It seems fair to say, therefore, that a Titan of any size would share the shit out of any Star Wars force it encountered.
Star Wars just gets hammered...