Ultimately, to sink a ship you need to let water in. Torpedoes are good at this.
Level bombers were basically ineffective at hitting moving ships, but most were Air Force aircraft rather than naval aviation. The effective styles were torpedo bombers and dive bombers. Dive bombers were quite accurate, tricky to intercept but lost effectiveness against heavily armoured targets because the explosions didn't tend to let water into the ship. Also, it seems that often the passage of the bomb through heavy armour tended to damage the bomb's fuse, so it didn't explode. Torpedo bombers were effective against all ships, but the predictable, slow, low approach required to launch a torpedo made them dead meat against competent defensive air cover.
As for specific examples, well, it's a bit odd in European waters because the British used torpedo bombers much more than dive bombers, and the Italians and Germans had no naval aviation at all, so it's hard to make any meaningful comparison! But Germany and Italy did have land-based level-, dive- and torpedo bombers.
Of Germany's four battleships, Bismarck was crippled by an aerial torpedo - no dive bombers were used against her. Tirpitz was damaged by numerous dive bomber hits, but not crippled, because of her armour. Neither Scharnhorst nor Gneisenau were ever seriously damaged by dive bombers, I think, but the British didn't use dive bombers much really. Instead they were repeatedly hit by submarine and destroyer torpedos and even level bombers while in port.
In the Med, it was torpedo bombers that crippled half the Italian battle line at Taranto, and crippling damage from aerial torpedoes resulted in a serious Italian defeat in the night action at Cape Matapan. The Italian fleets typically lacked air cover and so were vulnerable to torpedo attack, particularly the heavy ships which were generally more resistant to bomb damage. But the British didn't really use dive bombers much, so the comparison is tricky...
German dive bombers crippled the carrier HMS Illustrious with seven hits - but she survived because bombs aren't that good at letting water into the hull of a well-armoured ship. In contrast, Prince of Wales was crippled by a single aerial torpedo and subsequently sunk.
If I had to summarise things: in the face of defensive fighters, go dive bombers instead of torpedo bombers. Against heavily armoured ships, torpedo bombers are more effective. Against unarmoured carriers, choose dive bombers because you can expect hostile fighters and you just need to put a bomb into the carrier's hangar to cripple it. Against an armoured carrier, it's more equivocal.