I would never, not a million years, try and free-dive out of a boat, especially a large and unfamiliar boat that had sunk. It's almost certain death to try and do so.
1) No Breath: First of all, the average person can roughly hold their breath a minute or lets be generous and say one and a half minutes. Well, that's in perfect comfortable conditions in a nice warm, safe, room. Now you're in cold water, you're in shock because your boat sank, and you're in the dark, you're likely highly anxious or panicking, you can now hold your breath 30-45 seconds if doing no work at all. If you're actively swimming for your life you probably last for 20-30 seconds IF THAT.
2) Getting Lost: Dive boats can be quite large, full of random objects, and if you've been diving on a boat for a few days only, there is little chance you are going to be able to navigate through the boat in the dark in good conditions, now imagine the boat is filled with water, completely dark and upside down. You are panicked and disoriented, if you somehow manage to find an exit it's almost entirely down to dumb luck.
3) Depth (and potential DCS). You have no idea what depth the boat has sunk to. So let's say it's at 50m, it takes a long time to surface from 50m and if it's already taken you 1 minute to get out of the boat, you're fucked again. Not to mention any DCS you may suffer if you've been breathing compressed air down at 50m for very long!
Maybe there are some combination of factors which would make this a good idea, like, very small boat with very obvious exits, warm water in the tropics, shallow water and its daytime so there is light to see by, and you're also a champion free-diver and regularly do 7-9 minute breath holds. Sure in these cases you might just swim out.
But if you're a normal person trying to swim out of a boat in the dark, upside-down, in unknown depths, cold water, random detritus floating everywhere, just stay put!