Stability results for an inverse problem in potential theory