Assuming your shelf won't come apart under the weight of itself and books, you have several options.
1) Your shelf looks wider than standard 24" distance between studs, so you can mark location of the studs behind your shelf at the height where an UPPER horizontal shelf part crosses the stud. Do this near to the left end of the leftmost horizontal & the right end of the rightmost, and * MARK ON THE WALL AND SHELF BOTH *. Then buy "lag bolts" with a diameter of half the shelf part thickness (prolly 3/4" so half is 3/8"). But the longest you can find. Drill & screw pointy end into the wall& stud; make sure bolt is straight & level into the wall. Drill same-size (3/8") hole in back edge of your shelf, as deep as the bolt part sticking out the wall. Slide shelf unit over bolts into drilled holes until shelf is tight against wall. The threads on the bolt will grip the insides of the holes & won't slide off except maybe in an earthquake. Done.
2) if really heavy books, or lots, are on shelf, do same as 1) except don't drill into shelf - instead rest shelf on the bolts (paint bolts black if you like). This isn't as invisible but almost, and is MUCH stronger. OR use more than 2 lag bolts - up to every 4 inches if you want it bombproof.
3) Buy brackets the other poster suggested, but for your shelf you'll need 2 so the other box-area of your shelf doesn't twist itself & break off under weight.