Erm… I don’t actually know. I’d assume that would depend entirely on the type of fuse and how armoured the deck of the ship was. Likely to bounce off a battleship, but would punch through a destroyer.
Considering air-launched depth charges looked like this
It would probably either just explode on impact, or do nothing and get stuck somewhere in the superstructure, either way it would be a waste of a perfectly good anti-submarine weapon.
During the Battle of Samar, TBFs from Taffy 3 dropped depth charges on ships in Kurita’s force.
They dropped them in front of & along side the oncoming warships.