Take one of the terms (say, x^2 dy), and "partially integrate" it, with the other variable held constant, to get yx^2 + C(x) (since we're treating x as a constant, our "constant of integration" can in principle depend on x). Then take the x-derivative of this and set it equal to the dx part:
2xy + C'(x) = 2xy, so C'(x) = 0 or C(x) = C, just a constant. Thus d(yx^2 + C) = x^2 dy + 2xy dx, and we can just take C = 0 in particular.