Color/image to alpha in Blender
Using the compositor, you can use an Alpha Over node with the top socket set to 0 alpha and plug your main image into the bottom socket. This puts the 0 alpha under the image, and then using the image with the white in it as a mix factor for the alpha over node. To get the result I think you wanted, I inverted the color of the image used as a mask. Notice that since the image I used had a slight gradient of white in it, the black was not pure and so the image left has a slight transparency to it.
I also wanted to point out I saved the image result from the 'Viewer' output in the UV Image Editor, and then brought it back in as an image node to confirm that it had a definite alpha. Might need some cleanup with a dilate/erode node, but this gets you there.