Cut a 45-degree angle at each end of the top 2x4 crossbar of the pallet bed headboard, as well as the 2 standing 2x4s. Set cuts of the standing support flush with those in the crossbar and secure them with 2-3" screws on each side.
Take he best 12 slats from the pallets. 8 of the slats will be kept whole, with 4 being cut into 2-17" pieces. Using the 2" screws, screw one complete slat to the back of one of the supports. Make sure the slat is straight on the support, this will help line up the remainder of the pieces. Once this slat is secured, take a 17" piece and secure it in the other support, making sure it remains flush with the full slat. This will complete the 1st of 8 rows of slats. On the next row, you'll use the 17" slat on the side the full slat was on in the first row. Secure it the same way, making sure the 2nd row is flush with the first. Repeat this process until you have eight rows.
As they are now, there will be a loose seam on each row between the two sized slats. Turn the headboard over and take two extra slats and run them down the seams on the back side of the headboard. Using the 2" screws, secure the loose slats on each row to the back piece. It will give more stability to the headboard.
When the rows are complete, you'll insert the bottom crossbar. Cut the crossbar to fit snug inside the two supports. Place the crossbar overlapping the bottom row slightly. Secure the bar by using a 3" screw on each side. Run the screw from the underside of the bottom bar at a 45-degree angle toward the support.
You can secure this to a bedframe if you'd like, but it will be easier just to anchor it to the wall where the bed will be. I also put a 64" long 2x4 on top of the top crossbar for a little extra detail.