People typically need to be facing/laying along the axis of flight for the seatbelt to work. If you're laying at 90 degrees and there's a big (de/a)cceleration and you have a belt across your waist, you get folded in half hanging off the bed.
If you stack three people on top of each other then the you need egress (space one one or both sides of the beds) which takes up a bunch of space to get back/forward. Most seats have the aisle as egress but you need more mini-aisles for bunkbeds. You might want to divide it and say some people have egress forward and some backward to save the space... but if there's some kind of emergency you want people to be able to go whatever way they want.
If you think about roughly the volume of 3x3 seats (9 pax) then roughly speaking you could have three sets of three bunkbeds. But the curvature of the airframe means you don't have the same height near the window you do in the middle of the plane, and you may take away cabin baggage space. One way to get around this is to make the lowest bunk very low, like an inch off the deck, but that would mean a smaller market as you have to have pax who can get down low or climb up to the top.
All of this is assuming you're trying to go for the same kind of density of pax as a plane has today. If you just want two bunks and charge more, or you want to have a seat and a bunk (so you sleep only half the flight or something then someone else gets the bunk...) then the space requirements all change. You can also just have some bunks or just in the middle rows on a widebody and on the outside have seats.
Lastly, my memory is the flight computers will try to direct smaller aircraft movements in the vertical axis / pitch angle. Again from memory, but people get really sick if they have a bunch of movement side to side or at some other funny angle their vestibular system isn't used to. And with bunkbeds you might not have a window to look out of for a frame of reference to help. This is another constraint on how you lay people out on the plane.
It's all fixable kind-of but not just "put in a bunch of bunkbeds and make the same amount of money / same price per seat-mile". Someone with more knowledge can probably list all the reasons the FAA wouldn't allow it.
I still want bunkbeds though.