Aluminum frame quality - how much variation can there be and how to tell?
You actually point out two important characteristics in your photos: welds and hydroforming.

The more expensive frame (looks like specialized bikes) has shaped tubes and very clean welds, while the second frame has straight tubes and messy welds.

The shaping of tubes (hydroforming) isn't just for looks.  By shaping the tubes (in addition to butting) the bike designer can tune the ride characteristics. This can make aluminum behave stiffer or more supple depending on the application (e.g., stiff for a criterium bike or supple for an endurance bike). Shaping can also be used to get a mixture compliancy in one direction and stiffer in another. Because of the time and money involved in shaping the tubes, aluminum frames with highly shaped frames tend to come on higher end bikes.

Welds are also a good indicator of quality.  Cheaper frames will use less experienced labor and will care less about the fit and finish and more about hitting a particular bottom line.  

Of course neither of these characteristics are an absolute guarantee of quality, but welds and hydroforming  do tend to be associated with better build quality.

Finally, you also mention weight.  The biggest weight difference will come from the components used to build the frame rather than the frame itself.  When comparing two aluminum frames the weight difference will be less than 500g. Even if you knew the weight I personally don't think this is a good metric and the optimal weight also depends on the application and the typical forces that are expected to act on the frame.