I would use pressure treated pine (SYP). The bed in your second photo is SYP.
It's meant for outdoor use and won't rot or get eaten by bugs. If you're worried about shrinking and having the gaps between planks open a little, let it dry out for a few months, first.
Or you can buy Kiln Dried Pressure Treated Pine, known as KDAT.
If you buy the KDAT, you can apply stain immediately. If you buy the regular stuff, let it dry out before staining. Pressure Treated lumber doesn't require stain for outdoor use, though.
The chemicals used in the pressure treating will corrode certain fasteners so use only stainless steel or hot dipped galvanized steel fasteners (not electroplated galvanized).