Deeper or Wider: A Perspective from Optimal Generalization Error with Sobolev Loss