Depth of field is determined by the aperture. The bigger the aperture (i.e. the lower the f-stop number), the smaller the depth of field. So if you hope to have only a part of an image in focus, or the background out of focus, use a large aperture, e.g. f2.8. If you want as much as possible in focus, use a small aperture, e.g. f16.

The price

Everything has its price. If you want more depth of field, you will have to pay in an expensive currency: shutter speed. The smaller the aperture (to get the depth of field), the slower the shutter speed will have to be. So to attain a greater depth of field and avoid camera shake use either a tripod or sacrifice image quality by using a higher ISO.

How you can take a similar image

Lens: Wide angle lens.

Settings: Small aperture to increase depth of field so that all the birds are in focus. Increase the ISO until your shutter speed is fast enough to freeze the birds in flight (faster than 1/250 second).