Transferring music from an iPhone?

So I have some music that I got from my friends downloaded onto my iPhone 4S, and now I want to transfer it to my Macbook pro. However, it's telling me that I can only sync music from my laptop to my phone, and not vice versa. It also only lets me transfer purchased music from my phone, but not all of it was purchased to begin with. Is there any way around this to get the music off of my phone and onto my laptop?

First you will need to download MacX iPhone mounter, then install and launch it on your Mac pro. Then, connect your phone to your Mac(it will automatically recognize it and the device info will be show). Then after that, click the music button to get the music list, and choose the music you like to transfer from your Iphone to your Mac. And drag it and drop it on your Mac. Then, the music you like will successfully transferred to your Mac.

Hope it will help!