Creating segment conditions from where a visitor came from is simple! You can filter off of referrer hostname and/or referrer page stem.
Segment by referring hostname
A referrer hostname contains the subdomain, domain, and TLD (suffix) for the referring website. For example, if a visitor comes from a Google search result, the full referring site will be "www.google.com".
When defining a segment's conditions, choose "Referring Site" as the action. Then, choose the match pattern you'd like to use.
Segment by Google
As an example, let's say you want a condition that matches anyone that came from Google. You'd simply choose contains and enter "google."
Segment by referring path
This feature allows you to create a condition from the exact page a visitor may have come from. For example, say you want to create a segment for any visitor that came from www.mysite.com, specifically from the "Recommended Sites" blog article. You'd create conditions like so: