MorleyDNA has a tool for the Y-haplogroup:
https://ytree.morleydna.com/extractFromAutosomal
That’s for the paternal line only, and it will only give a prediction of a high-level group. The prediction could still be wrong, and the group will probably have formed many thousands of years ago.
I don’t think you can infer a maternal haplogroup from an Ancestry test, because I don’t think they measure any of your mitochondrial DNA
This is the first I have heard of that. Interesting, and there was a previous discussion about this "Can you get YDNA from Ancestry" in G2G.