what's the difference between the two bombers/aircraft
In a specifically maritime context,
effectiveness, possibly
Torpedoes are underwater missiles propelling warheads against the most vulnerable part of the ship, the hull beneath the waterline.
It can either be delivered directly against the hull of the ship beneath the waterline, leading to flooding, listing, and capsizing. If the explosion occurred in or near the magazines, the ship might also blow up, but this is a secondary event.
Or it can detonate under the ship, creating a mine effect to break the ship in two.
Both primary events would mean certain destruction to smaller ships. Even larger and more-heavily armoured ships, eg Ark Royal and Yamato, when hit by enough torpedoes, would be sunk.
Bombs could be viewed in the same way except that gravity replaces the driving missile.
Dive bombing also comprises a primary event - that gravity-driven bomb plunging down to penetrate the decks of a ship, and exploding in its vitals. However, there is a good chance that this event in itself would be unable to sink a ship, unlike a torpedo.
The bomb really needs to trigger a secondary event, in order to sink the ship. At Pearl Harbour, a bomb penetrated the hull, hitting the magazine of the Arizona. At Midway, the bombs hit Japanese carriers filled with fuelled and armed planes - both destroyed by secondary events.
It's worthy of note that at Midway, none of the US torpedo bombers (Devastators) got through, both the Kaga and the Akagi were hit by dive bombers (Dauntlesses) and that despite the presence of fuelled and armed fighters on the decks (ie secondary events) the two carriers
still didn't sink (though they were gutted by fire). The final US wave, also dive bombers, then hit the Soryu which had to be abandoned. It didn't sink either and was eventually finished off by a US submarine.
The Yorktown was the target of a very aggressive and accurate dive bombing attack by Val dive bombers, and yet was operational again within a few hours and under way. If bombs do not trigger significant secondary events, then they likely might not sink the ship which could well be saved to fight another day. It could even be quickly patched up and returned to the fight.
Another good example were the attacks on the Tirpitz. Several carrier-launched strikes were initiated against the Tirpitz. They did a lot of damage to the superstructure, but never succeeded in sinking the ship. It took the 12,000lb Tallboy to deliver enough weight and explosives to fully penetrate the hull, and place the hull down on the shallow fjord bed (sunk insofar as that was as far as it could sink).
If the Tirpitz had been at sea, and been attacked with torpedoes, 500 pounds of TNT applied directly to its hull might well have achieved the same end.