The mass of proton is less than neutron therefore a proton cannot convert into neutron as mass can neither be created nor destroyed but when both of them are in the nucleus the nuclear force provide the binding energy required for the reaction to take place.