Automatic Weights doesn't work well on a cloth simulation mesh, but works perfectly on a handmade one
Ok, so if someone is in the same situation as me, I found a way to make the Automatic Weights work: you must  apply a remesh or some kind of modifier which will change the mesh, for example: I applied a wireframe with very low thickness, merged all verts automatically with Auto Merge, rebuilt all faces with Mesh - Clean Up- Fill Holes; and now it works perfectly. So now you end up with exactly the same mesh, but the Auto Weights will work.
Probably there is a much simpler and sophisticated way to do this, but this way works.