Yes it can be done. There is some interesting imagery on Knight Armaments website about a modification they did to the M4 to allow it to use AK47 magazines and the 7.62x43mm Short round. I believe it was done in response to a UOR from Afghanistan, where SF soldiers were running out of 5.56mm during cave system assaults; their thinking was that they could continue to use a rifle they were familiar with, but easily take 30-rd AK magazines from the enemy.
It makes you ask this question, therefore; why not pick up an AK when you are low on ammunition and use it?