On the Characterization of Algebraically Integrable Plane Foliations