Possible, yes, but worth it? Not likely. You're better off replacing the timing belt on your friend's car if that's all that's wrong with it, as it would be a lot of work (custom motor mounts, re-wiring and so forth) just to swap in the KA24DE. Too complicated if you're just looking for a little power (would be a measely upgrade in power, if any).
If you're interested in power, there's plenty of people who have swapped a VQ35DE into a Sentra, and many more that have had success with the SR20DET engine. Just food for thought.