@Manan Surana Transferring from your personal one demat to another is quite easy if both the demat are from CDSL. CDSL Easiest facility registration can be done and then bulk transaction is setup and authenticated using TPIN and shares are easily transferred. Minimal charges are levied for this off-market transfer
On the other hand if you wish to transfer shares from your friend's demat to yours. This can be done in the same way as explained above but Gift taxation comes in for the person receiving shares if gift value exceeds 50,000 as friend is not included in the relative list of a person.
Doing it from NSDL to CDSL, online methods are less feasible and offline way is suggested for that using Delivery Instruction Slip (DIS)