For Blender Internal it's as easy as making a material shadeless and mapping the Matcap texture with Normal mapping:
For Cycles you need to stack some nodes to get the correct mapping:
Note: In versions 2.76rc3 and earlier this doesn't work when Open Shading Language and CPU rendering is enabled. The Vector Transform gives invalid output. This is a bug that has been fixed in the latest builds.
Important Update: From version 2.76 we now must change the Vector Transform Node's vector type from Point to Normal. Apparently it should not have worked with Point before, but it did because not all location information was being taken into account - now it is.