With the hands you described it is a flip. The odds
calculator has you at basically a 50%-49% advantage with a 1% chance of tying.
That said, unless you know that this guy is going to call you very, very wide (which might be the case, considering he called with pocket 2s), the all-in preflop was a terrible idea. It folds things you dominate (kj, k10, qj,q10 and the like) and keeps things in that crush you (AK, AQ, QQ, KK, AA)