Interplay between depth of neural networks and locality of target functions