First, understand that the Ancestry analysis can only be as good as the data they have collected.
They have found that your DNA has similarities to people who presently live in the Mayo/Sligo area. So, they have concluded that you have ancestors from the May/Sligo area. But, the DNA test alone won't tell them how far back the connection is. It could be much further than 2 generations.
I am guessing that a family needs to be in the same area for about 5 generations for their DNA to mix with the population in the area enough to show similarities. Probably fewer generations if the immigrants to the area are the dominant group.
They can also combine the DNA information with known historical migration patterns to make more conclusions.
Here is the analysis for my DNA. I have marked the areas that I know my ancestors lived with red circles.
My father's ancestors are from Croatia, very close to where Ancestry concluded. But, historical experts tell us that Croatia was mostly settled from the northeast of Croatia (many hundreds of years ago). That explains why my DNA has similarities to people from Russia/Ukraine/etc.
It looks like they got my northeast German ancestors wrong. But, not really, this just means that my German ancestors did not live in that area long enough to share their DNA with the present population.