code: public void writeAttributes(Iterable<Attribute> attributes) throws IOException {
      List<String> attributeNames = Lists.newArrayList();
      List<String> attributeLabels = Lists.newArrayList();
  
      for (Attribute attr : attributes) {
        attributeNames.add(attr.getName());
        if (attr.getLabel() != null) {
          attributeLabels.add(attr.getLabel());
        } else {
          attributeLabels.add(attr.getName());
        }
      }
  
      writeAttributes(attributeNames, attributeLabels);
    }
docs: Use attribute labels as column names